home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / ibm / fasrc1p2.arc / ASEMBLER.DOC < prev    next >
Text File  |  1990-07-15  |  14KB  |  324 lines

  1.  
  2.  
  3.  
  4.  
  5.                    The IBM PC 6800/01/04/05/09/11 cross assemblers
  6.  
  7.  
  8.           GENERAL
  9.                   The assemblers are named as*.exe where '*' is any of 0,
  10.                   1, h1, 4, 5, 9, or 11 depending on which one you're
  11.                   using.  Command line arguments specify the filenames to
  12.                   assemble.
  13.  
  14.                   The assemblers accept options from the command line to be
  15.                   included in the assembly.  These options are the
  16.                   following:
  17.  
  18.                           l      enable output listing.
  19.                           nol    disable output listing (default).
  20.                           cre    generate cross reference table.
  21.                           s      generate a symbol table.
  22.                           c      enable cycle count.
  23.                           noc    disable cycle count.
  24.  
  25.                   The command line looks like this :
  26.  
  27.                           as* file1 file2 ... [ - option1 option2 ...]
  28.  
  29.                   If this method of passing commands to the assembler is
  30.                   used rather than the OPT pseudo op code, a space should
  31.                   separate the minus sign from the last file name and the
  32.                   first option.  Example:
  33.  
  34.                           as5 program - l cre
  35.  
  36.                   This command assembles file 'program' with an output
  37.                   listing and a cross reference table.
  38.  
  39.                   The `S1' formatted object file is placed in file
  40.                   `filename.S19' (m.out on older versions).  The listing
  41.                   and error messages are written to the standard output.
  42.                   If multiple files are assembled, the 'S1' file will be
  43.                   placed under the first file's name.S19.
  44.  
  45.                   The listing file contains the address and bytes assembled
  46.                   for each line of input followed by the original input
  47.                   line (unchanged, but moved over to the right some).  If
  48.                   an input line causes more than 6 bytes to be output (e.g.
  49.                   a long FCC directive), additional bytes (up to 64) are
  50.                   listed on succeding lines with no address preceding them.
  51.  
  52.                   Equates cause the value of the expression to replace the
  53.                   address field in the listing.
  54.  
  55.                   Equates that have forward references cause Phasing Errors
  56.                   in Pass 2.
  57.  
  58.                   Expressions may consist of symbols, constants or the
  59.                   character '*' (denoting the current value of the program
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.                   counter) joined together by one of the operators: +-
  72.                   */%&|^.  The operators are the same as in C:
  73.  
  74.                           +      add
  75.                           -      subtract
  76.                           *      multiply
  77.                           /      divide
  78.                           %      remainder after division
  79.                           &      bitwise and
  80.                           |      bitwise or
  81.                           ^      bitwise exclusive-or
  82.  
  83.                   Expressions are evaluated left to right and there is no
  84.                   provision for parenthesized expressions.  Arithmetic is
  85.                   carried out in signed twos-complement integer precision
  86.                   (16 bits on the IBM PC)
  87.  
  88.                   Constants are constructed with the same syntax as the
  89.                   Motorola MDOS assembler:
  90.  
  91.                           '      followed by ASCII character
  92.                           $      followed by hexadecimal constant
  93.                           @      followed by octal constant
  94.                           %      followed by binary constant
  95.                           digit  decimal constant
  96.  
  97.  
  98.           ERRORS
  99.                   Error diagnostics are placed in the listing file just
  100.                   before the line containing the error.  Format of the
  101.                   error line is:
  102.  
  103.                      File_name,Line_number: Error -> Description of error
  104.                                  or
  105.                      File_name,Line_number: Warning --- Description of error
  106.  
  107.                   Errors of the first type in pass one cause cancellation
  108.                   of pass two.  Warnings do not cause cancellation of pass
  109.                   two but should cause you to wonder where they came from.
  110.  
  111.                   Error messages are meant to be self-explanatory.
  112.  
  113.                   Finally, some errors are classed as fatal and cause an
  114.                   immediate termination of the assembly.  Generally these
  115.                   errors occur when a temporary file cannot be created or
  116.                   is lost during the assembly. Consult your local guru if
  117.                   this happens.
  118.  
  119.  
  120.           DIFFERENCES
  121.  
  122.                   For indexed addressing, the comma is required before the
  123.                   register; `inc x' and `inc ,x' are not the same.
  124.  
  125.                   Macros are not supported.  (try M4 or M6)
  126.  
  127.                   The force size operators ('>' and '<') are implemented
  128.                   for all assemblers.
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.                   The only pseudo-ops supported are:
  138.  
  139.                           ORG, FCC, FDB, FCB, EQU, RMB, BSZ, ZMB, FILL,
  140.                           PAGE, END, and OPT.
  141.  
  142.                   The OPT pseudo-op allows the following operands:
  143.  
  144.                           nol     Turn off output listing
  145.                           l       Turn on output listing (default)
  146.                           noc     Disable cycle counts in listing (default)
  147.                           c       Enable cycle counts in listing (clear
  148.                                      total cycles)
  149.                           contc   Re-enable cycle counts (don't clear total
  150.                                      cycles)
  151.                           cre     Enable printing of a cross reference
  152.                                      table
  153.                           s       generate a symbol table
  154.  
  155.                   Some of the more common pseudo-ops are not present:
  156.  
  157.                           SPC     Use blank lines instead
  158.                           TTL     use `pr' to get headings and page numbers
  159.                           NAM[E]  Did you ever use this one anyway?
  160.  
  161.                           The above pseudo-ops are recognized, but ignored.
  162.  
  163.                   ZMB (Zero Memory Bytes) is equivalent to BSZ (Block Store
  164.                   Zeroes). FILL can be used to initialize memory to
  165.                   something other than zero:
  166.                           FILL val,nbytes.
  167.  
  168.           TARGET MACHINE SPECIFICS
  169.  
  170.            (as0) 6800:  Use for 6802 and 6808 too.
  171.  
  172.            (as1) 6801:  You could use this one for the 6800 and avoid LSRD,
  173.                         ASLD, PULX, ABX, PSHX, MUL, SUBD, ADDD, LDD and
  174.                         STD.
  175.  
  176.                  6301:  Called ash1 (Hitachi 6801).  Same as 6801 except
  177.                         cycle times are reduced and a few new instructions
  178.                         are added: XGDX, SLP, AIM, OIM, EIM, TIM.
  179.                         Convenience mnemonics BSET, BCLR, BTGL, BCHG and
  180.                         BTST are also present which generate appropriate
  181.                         mask values:
  182.  
  183.                                   BSET 4,dog --> OIM #10,dog
  184.  
  185.                         Bit manipulation using indexed addressing is
  186.                         specified with a trailing ",x": aim #mask,index,x
  187.                         or btgl 5,index,x.
  188.  
  189.            (as4) 6804:  The symbols 'a', 'x' and 'y' are predefined as $FF,
  190.                         $80 and $81 respectively.  Also defined as 'A', 'X'
  191.                         and 'Y'.  Because of the 6804 architecture, this
  192.                         means that 'clr x' will work since the x register
  193.                         is just a memory location. To use short-direct
  194.                         addressing, the symbol involved must not be a
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.                         forward reference (i.e. undefined) and must be in
  204.                         the range $80-$83.
  205.  
  206.                         Remember that bytes assembled in the range $10-$7F
  207.                         will go into the data space; There is no program
  208.                         space ROM for these locations.
  209.  
  210.                         The syntax for Register indirect addressing is as
  211.                         follows:
  212.                                   mnemonic [<x>or<y>]
  213.                         an example is:
  214.                                   lda [x]
  215.  
  216.                         The MVI instruction (move immediate) has its own
  217.                         format :
  218.                                   mvi address,#data
  219.                         where address is an 8-bit address in page zero,
  220.                         and data is the value to be written to specified
  221.                         location.
  222.  
  223.            (as5) 6805:  There is no 'opt cmos' pseudo, so be careful not to
  224.                         use STOP or WAIT in a program that is destined for
  225.                         an NMOS version of the 6805.  The MUL instruction
  226.                         should also be avoided on all versions of the 6805
  227.                         except the C4.  Cycle times are for the NMOS
  228.                         versions.
  229.  
  230.            (as9) 6809:  The SETDP pseudo-op is not implemented.  Use the
  231.                         '>' and '<' operators to force the size of
  232.                         operands.
  233.  
  234.                         For compatibility, CPX is equal to CMPX.
  235.  
  236.            (as11) 68HC11:  Bit manipulation operands are separated by
  237.                         blanks instead of commas since the 'HC11 has bit
  238.                         manipulation instructions that operate on indexed
  239.                         addresses.
  240.  
  241.  
  242.           DETAILS
  243.                   Symbol:  A string of characters with an initial non-
  244.                         digit. The string of characters may be from the
  245.                         set:
  246.  
  247.                                   [a-z][A-Z]_.[0-9]$
  248.  
  249.                         ( . and _ count as non-digits ).  The `$' counts as
  250.                         a digit to avoid confusion with hexadecimal
  251.                         constants.  All characters of a symbol are
  252.                         significant, with upper and lower case characters
  253.                         being distinct.  The maximum number of characters
  254.                         in a symbol is currently set at 15.
  255.  
  256.                         The symbol table has room for at least 2000 symbols
  257.                         of length 8 characters or less.
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                   Label:  A symbol starting in the first column is a label
  269.                         and may optionally be ended with a ':'.  A label
  270.                         may appear on a line by itself and is then
  271.                         interpreted as:
  272.  
  273.                                Label  EQU    *
  274.  
  275.                   Mnemonic:  A symbol preceded by at least one whitespace
  276.                         character. Upper case characters in this field are
  277.                         converted to lower case before being checked as a
  278.                         legal mnemonic.  Thus `nop', `NOP' and even `NoP'
  279.                         are recognized as the same mnemonic.
  280.  
  281.                         Note that register names that sometimes appear at
  282.                         the end of a mnemonic (e.g. nega or stu) must not
  283.                         be separated by any whitespace characters.  Thus
  284.                         `clra' means clear accumulator A, but that `clr a'
  285.                         means clear memory location `a'.
  286.  
  287.                   Operand:  Follows mnemonic, separated by at least one
  288.                         whitespace character.  The contents of the operand
  289.                         field is interpreted by each instruction.
  290.  
  291.                   Whitespace:  A blank or a tab
  292.  
  293.                   Comment:  Any text after all operands for a given
  294.                         mnemonic have been processed or, a line beginning
  295.                         with '*' or ';' up to the end of line or, an empty 
  296.                         line or, the remainder of a line after ';' (at 
  297.                         least one space or tab must precede the semicolon 
  298.                         if it is not the first character on the line)
  299.  
  300.  
  301.           FILES
  302.                   filename.S19  S-record output file
  303.                   STDOUT        listing and errors (use redirection for
  304.                                    listing file)
  305.                   Fwd_refs      Temporary file for forward references.
  306.  
  307.  
  308.           IMPLEMENTATION NOTES
  309.                   This is a classic 2-pass assembler.  Pass 1 establishes
  310.                   the  symbol table and pass 2 generates the code.
  311.  
  312.                                                           12/11/84 E.J.Rupp
  313.  
  314.  
  315.                   This version of the cross assemblers updated by Greg 
  316.                   Thoman in July, 1990 and includes the correction and 
  317.                   enhancements made by Bruce Olney.
  318.                   
  319.                   Previous version of the cross assemblers ported to the 
  320.                   IBM PC on 4/13/87.
  321.                   
  322.                   The "older versions" mentioned above were ported to the
  323.                   IBM PC on 7/25/85.
  324.